import {ParamsType} from "@ant-design/pro-components";
import {addData, deleteById, listData, pageData, updateById, get} from "@/services/base-request";

export const pageQuestionAPI = (params: ParamsType) => {
  return pageData("/question", params)
}

export const listQuestionAPI = (params: DynamicObject) => {
  return listData("/question", params)
}

export const addQuestionAPI = (data: API.IQuestion) => {
  return addData("/question", data)
}

export const updateQuestionAPI = (data: API.IQuestion) => {
  return updateById("/question", data)
}

export const deleteQuestionAPI = (id: string | number) => {
  return deleteById("/question", id)
}

export const getQuestionOptionsAPI = (questionId: string | number) => {
  return get(`/questionOption/getByQuestion/${questionId}`, {})
}
export const addQuestionOptionAPI = (data: API.IQuestionOption) => {
  return addData("/questionOption", data)
}

export const updateQuestionOptionAPI = (data: API.IQuestionOption) => {
  return updateById("/questionOption", data)
}
export const deleteQuestionOptionAPI = (id: string | number) => {
  return deleteById("/questionOption", id)
}
